package com.lzw.softpo_viewpageranimation;

import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;

import com.softpo.viewpagertransformer.ScaleInOutTransformer;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private ViewPager viewPager;
    private MyAdapter myAdapter;
    private List<ImageView> data = new ArrayList<>();
    private int [] imageViews ={R.mipmap.j,R.mipmap.k,R.mipmap.l,R.mipmap.m};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        viewPager.setAdapter(myAdapter);
        viewPager.setPageTransformer(false,new ScaleInOutTransformer());
    }

    private void initView() {
        viewPager = (ViewPager) findViewById(R.id.view_pager);
        viewPager.setPageMargin(80);
        for (int i = 0; i < imageViews.length; i++) {
            ImageView imageView = new ImageView(this);
            imageView.setImageResource(imageViews[i]);
            data.add(imageView);
        }
        myAdapter = new MyAdapter(data);
    }
}
